require("lualib_bundle");
__TS__SourceMapTraceBack(debug.getinfo(1).short_src, {["4"] = 1,["5"] = 1,["6"] = 2,["7"] = 2,["8"] = 3,["9"] = 3,["10"] = 6,["11"] = 6,["12"] = 6,["14"] = 16,["15"] = 17,["16"] = 18,["17"] = 15,["18"] = 22,["19"] = 23,["20"] = 24,["21"] = 25,["22"] = 26,["23"] = 27,["24"] = 28,["25"] = 28,["26"] = 28,["27"] = 28,["28"] = 28,["29"] = 29,["30"] = 29,["31"] = 29,["32"] = 29,["33"] = 29,["34"] = 29,["35"] = 29,["36"] = 29,["37"] = 29,["39"] = 31,["40"] = 32,["41"] = 32,["42"] = 32,["43"] = 32,["44"] = 32,["45"] = 33,["46"] = 33,["47"] = 33,["48"] = 33,["49"] = 33,["50"] = 33,["51"] = 33,["52"] = 33,["53"] = 33,["56"] = 23,["57"] = 22,["58"] = 12,["59"] = 6});
local ____exports = {}
local ____trigger = require("solar.w3ts.handles.trigger")
local Trigger = ____trigger.Trigger
local ____SelectUtil = require("solar.util.SelectUtil")
local SelectUtil = ____SelectUtil.default
local ____TextTagUtil = require("solar.util.TextTagUtil")
local TextTagUtil = ____TextTagUtil.default
____exports.default = __TS__Class()
local AddResourceByUnitTypeOnTimerState = ____exports.default
AddResourceByUnitTypeOnTimerState.name = "AddResourceByUnitTypeOnTimerState"
function AddResourceByUnitTypeOnTimerState.prototype.____constructor(self)
    local trigger = __TS__New(Trigger)
    trigger:registerTimerEvent(1, true)
    trigger:addAction(self.action)
end
function AddResourceByUnitTypeOnTimerState.prototype.action()
    SelectUtil.forAllUnits(function(____, unit)
        local cfgData = ____exports.default.config[id2string(GetUnitTypeId(unit))]
        if cfgData then
            local player = GetOwningPlayer(unit)
            if cfgData.addGold and cfgData.addGold ~= 0 then
                SetPlayerState(
                    player,
                    PLAYER_STATE_RESOURCE_GOLD,
                    GetPlayerState(player, PLAYER_STATE_RESOURCE_GOLD) + cfgData.addGold
                )
                TextTagUtil.text(
                    tostring(cfgData.addGold) .. "",
                    unit,
                    15,
                    0.5,
                    205,
                    127,
                    50
                )
            end
            if cfgData.addLumber and cfgData.addLumber ~= 0 then
                SetPlayerState(
                    player,
                    PLAYER_STATE_RESOURCE_LUMBER,
                    GetPlayerState(player, PLAYER_STATE_RESOURCE_LUMBER) + cfgData.addLumber
                )
                TextTagUtil.text(
                    tostring(cfgData.addLumber) .. "",
                    unit,
                    15,
                    0.5,
                    0,
                    255,
                    0
                )
            end
        end
    end)
end
AddResourceByUnitTypeOnTimerState.config = {}
____exports.default = AddResourceByUnitTypeOnTimerState
return ____exports
